<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class MqttServiceProvider extends ServiceProvider
{
    /**
     * Register services.
     *
     * @return void
     */
    public function register()
    {
        $server   = env('MQTT_HOST');
        $port     = 1883;
        $clientId = 'laravel-publisher';
        $this->app->singleton(\PhpMqtt\Client\MqttClient::class, function ($app) use ($server, $port, $clientId) {
            return new \PhpMqtt\Client\MqttClient($server, $port, $clientId);
        });

    }

    /**
     * Bootstrap services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }
}
